var deviceone = require("deviceone");
var global = deviceone.sm("do_Global");
var cacher = deviceone.sm("do_DataCache");

//当前选中-标签名称
var mapValue_selectedTagName = "";
var mapKey_selectTagName = "mapKey_selectTagName";
function selectTagName(){
	if(arguments.length==0){
		if(cacher.hasData(mapKey_selectTagName)){
			var value = cacher.loadData(mapKey_selectTagName);
			if(!value || value==null || value==="undefined"){
				return mapValue_selectedTagName;
			}else{
				return value;
			}
		}else{
			return mapValue_selectedTagName;
		}
	}
	if(arguments[0]===""){
		cacher.removeData(mapKey_selectTagName);
		return;
	}
	cacher.saveData(mapKey_selectTagName,""+arguments[0]);
}
module.exports.selectTagName = selectTagName;

//当前选中-城市名称
var mapValue_selectedCityName = "北京";
var mapKey_selectCityName = "mapKey_selectCityName";
function selectCityName(){
	if(arguments.length==0){
		if(cacher.hasData(mapKey_selectCityName)){
			var value = cacher.loadData(mapKey_selectCityName);
			if(!value || value==null || value==="undefined"){
				return mapValue_selectedCityName;
			}else{
				return value;
			}
		}else{
			return mapValue_selectedCityName;
		}
	}
	if(arguments[0]===""){
		cacher.removeData(mapKey_selectCityName);
		return;
	}
	cacher.saveData(mapKey_selectCityName,""+arguments[0]);
}
module.exports.selectCityName = selectCityName;

//当前选中-城市ID
var mapValue_selectCityId = "110200000";
var mapKey_selectCityId = "mapKey_selectCityId";
function selectCityId(){
	if(arguments.length==0){
		if(cacher.hasData(mapKey_selectCityId)){
			var value = cacher.loadData(mapKey_selectCityId);
			if(!value || value==null || value==="undefined"){
				return mapValue_selectCityId;
			}else{
				return value;
			}
		}else{
			return mapValue_selectCityId;
		}
	}
	if(arguments[0]===""){
		cacher.removeData(mapKey_selectCityId);
		return;
	}
	cacher.saveData(mapKey_selectCityId,""+arguments[0]);
}
module.exports.selectCityId = selectCityId;

//当前定位-城市名称
var mapValue_currentCityName = "北京";
var mapKey_currentCityName = "mapKey_currentCityName";
function currentCityName(){
	if(arguments.length==0){
		if(cacher.hasData(mapKey_currentCityName)){
			var value = cacher.loadData(mapKey_currentCityName);
			if(!value || value==null || value==="undefined"){
				return mapValue_currentCityName;
			}else{
				return value;
			}
		}else{
			return mapValue_currentCityName;
		}
	}
	if(arguments[0]===""){
		cacher.removeData(mapKey_currentCityName);
		return;
	}
	cacher.saveData(mapKey_currentCityName,""+arguments[0]);
}
module.exports.currentCityName = currentCityName;

//当前定位-城市ID
var mapValue_currentCityId = "110200000";
var mapKey_currentCityId = "mapKey_currentCityId";
function currentCityId(){
	if(arguments.length==0){
		if(cacher.hasData(mapKey_currentCityId)){
			var value = cacher.loadData(mapKey_currentCityId);
			if(!value || value==null || value==="undefined"){
				return mapValue_currentCityId;
			}else{
				return value;
			}
		}else{
			return mapValue_currentCityId;
		}
	}
	if(arguments[0]===""){
		cacher.removeData(mapKey_currentCityId);
		return;
	}
	cacher.saveData(mapKey_currentCityId,""+arguments[0]);
}
module.exports.currentCityId = currentCityId;


//当前定位的原省份和城市名称
var mapKey_currentLocationName = "mapKey_currentLocationName";
function currentLocationName(){
	if(arguments.length==0){
		if(cacher.hasData(mapKey_currentLocationName)){
			var value = cacher.loadData(mapKey_currentLocationName);
			if(!value || value==null || value==="undefined"){
				return "";
			}else{
				return value;
			}
		}else{
			return "";
		}
	}
	if(arguments[0]===""){
		cacher.removeData(mapKey_currentLocationName);
		return;
	}
	cacher.saveData(mapKey_currentLocationName,""+arguments[0]);
}
module.exports.currentLocationName = currentLocationName;